package com.ltkj.baseplatform.service.impl;

import java.util.List;
import com.ltkj.common.core.utils.DateUtils;
import com.ltkj.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ltkj.baseplatform.mapper.SerAgreementMapper;
import com.ltkj.baseplatform.domain.SerAgreement;
import com.ltkj.baseplatform.service.ISerAgreementService;

/**
 * 协议Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-09-22
 */
@Service
public class SerAgreementServiceImpl implements ISerAgreementService 
{
    @Autowired
    private SerAgreementMapper serAgreementMapper;

    /**
     * 查询协议
     * 
     * @param id 协议主键
     * @return 协议
     */
    @Override
    public SerAgreement selectSerAgreementById(Long id)
    {
        return serAgreementMapper.selectSerAgreementById(id);
    }

    /**
     * 查询协议列表
     * 
     * @param serAgreement 协议
     * @return 协议
     */
    @Override
    public List<SerAgreement> selectSerAgreementList(SerAgreement serAgreement)
    {
        return serAgreementMapper.selectSerAgreementList(serAgreement);
    }

    /**
     * 新增协议
     * 
     * @param serAgreement 协议
     * @return 结果
     */
    @Override
    public int insertSerAgreement(SerAgreement serAgreement)
    {
        serAgreement.setCreateTime(DateUtils.getNowDate());
        serAgreement.setCreateBy(SecurityUtils.getLoginUser().getUsername());
        return serAgreementMapper.insertSerAgreement(serAgreement);
    }

    /**
     * 修改协议
     * 
     * @param serAgreement 协议
     * @return 结果
     */
    @Override
    public int updateSerAgreement(SerAgreement serAgreement)
    {
        serAgreement.setUpdateTime(DateUtils.getNowDate());
        serAgreement.setUpdateBy(SecurityUtils.getLoginUser().getUsername());
        return serAgreementMapper.updateSerAgreement(serAgreement);
    }

    /**
     * 批量删除协议
     * 
     * @param ids 需要删除的协议主键
     * @return 结果
     */
    @Override
    public int deleteSerAgreementByIds(Long[] ids)
    {
        return serAgreementMapper.deleteSerAgreementByIds(ids);
    }

    /**
     * 删除协议信息
     * 
     * @param id 协议主键
     * @return 结果
     */
    @Override
    public int deleteSerAgreementById(Long id)
    {
        return serAgreementMapper.deleteSerAgreementById(id);
    }
}
